#!/usr/bin/python
# -*- coding: UTF-8 -*-

import re
import sys
import os
import time
import threading
import datetime
import random
import base64

os.system("sudo service redis-server restart > /dev/null 2>&1")
#os.system("redis-cli FLUSHALL")
starttime = datetime.datetime.now()
for num in range(1,10000):
	os.system("redis-cli -h 127.0.0.1 -p 6379 set key%s %s" % (num,base64.b64encode(os.urandom(90000))))
#os.system("redis-benchmark -t set -n 1000000 -r 50000000 -d 1024")
#os.system("redis-benchmark -t get -n 1000000 -r 100000000 -d 1024")
#for num in range(1,10000):
#	os.system("redis-cli -h 127.0.0.1 -p 6379 get key%d > /dev/null 2>&1" % (random.randint(1,10000)))
endtime = datetime.datetime.now()
print "Redis:" + str((endtime - starttime).total_seconds())
os.system("sudo service redis-server restart > /dev/null 2>&1")
